/**
 * <copyright>
 * </copyright>
 *
 */
package org.xtext.example.mydsl.myDsl.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtext.example.mydsl.myDsl.IP;
import org.xtext.example.mydsl.myDsl.IPNoAceptaIp;
import org.xtext.example.mydsl.myDsl.MyDslPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>IP No Acepta Ip</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.IPNoAceptaIpImpl#getIp1 <em>Ip1</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.IPNoAceptaIpImpl#getIp2 <em>Ip2</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class IPNoAceptaIpImpl extends FiltroImpl implements IPNoAceptaIp
{
  /**
   * The cached value of the '{@link #getIp1() <em>Ip1</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIp1()
   * @generated
   * @ordered
   */
  protected IP ip1;

  /**
   * The cached value of the '{@link #getIp2() <em>Ip2</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIp2()
   * @generated
   * @ordered
   */
  protected IP ip2;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected IPNoAceptaIpImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MyDslPackage.Literals.IP_NO_ACEPTA_IP;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public IP getIp1()
  {
    return ip1;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetIp1(IP newIp1, NotificationChain msgs)
  {
    IP oldIp1 = ip1;
    ip1 = newIp1;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDslPackage.IP_NO_ACEPTA_IP__IP1, oldIp1, newIp1);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setIp1(IP newIp1)
  {
    if (newIp1 != ip1)
    {
      NotificationChain msgs = null;
      if (ip1 != null)
        msgs = ((InternalEObject)ip1).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.IP_NO_ACEPTA_IP__IP1, null, msgs);
      if (newIp1 != null)
        msgs = ((InternalEObject)newIp1).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.IP_NO_ACEPTA_IP__IP1, null, msgs);
      msgs = basicSetIp1(newIp1, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.IP_NO_ACEPTA_IP__IP1, newIp1, newIp1));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public IP getIp2()
  {
    return ip2;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetIp2(IP newIp2, NotificationChain msgs)
  {
    IP oldIp2 = ip2;
    ip2 = newIp2;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDslPackage.IP_NO_ACEPTA_IP__IP2, oldIp2, newIp2);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setIp2(IP newIp2)
  {
    if (newIp2 != ip2)
    {
      NotificationChain msgs = null;
      if (ip2 != null)
        msgs = ((InternalEObject)ip2).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.IP_NO_ACEPTA_IP__IP2, null, msgs);
      if (newIp2 != null)
        msgs = ((InternalEObject)newIp2).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.IP_NO_ACEPTA_IP__IP2, null, msgs);
      msgs = basicSetIp2(newIp2, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.IP_NO_ACEPTA_IP__IP2, newIp2, newIp2));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MyDslPackage.IP_NO_ACEPTA_IP__IP1:
        return basicSetIp1(null, msgs);
      case MyDslPackage.IP_NO_ACEPTA_IP__IP2:
        return basicSetIp2(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.IP_NO_ACEPTA_IP__IP1:
        return getIp1();
      case MyDslPackage.IP_NO_ACEPTA_IP__IP2:
        return getIp2();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MyDslPackage.IP_NO_ACEPTA_IP__IP1:
        setIp1((IP)newValue);
        return;
      case MyDslPackage.IP_NO_ACEPTA_IP__IP2:
        setIp2((IP)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.IP_NO_ACEPTA_IP__IP1:
        setIp1((IP)null);
        return;
      case MyDslPackage.IP_NO_ACEPTA_IP__IP2:
        setIp2((IP)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.IP_NO_ACEPTA_IP__IP1:
        return ip1 != null;
      case MyDslPackage.IP_NO_ACEPTA_IP__IP2:
        return ip2 != null;
    }
    return super.eIsSet(featureID);
  }

} //IPNoAceptaIpImpl
